from networkFramework import *
from dataStruct import quoteStruct as qStruct
from framework import *

def main():
    
    configData = getQSConfig()
    
    if len(sys.argv) == 3:
        host = sys.argv[1]
        port = int(sys.argv[2])
    else:
        host = configData['host']
        port = configData['port']

    quotes = makeQuotes(configData['min'], configData['max'], configData['count'], configData['symbol'])
    
    quoteObj = qStruct()
    buffSize = quoteObj.getBuffSize()
    
    sUDPConn = senderUDPConn(host, port)
    
    for quote in quotes:    
        quoteObj.bufferValues(quote)
        sUDPConn.sendData(quoteObj.buffer.raw)
        blah = quoteObj.getValues()
        print blah
          
    sUDPConn.close()

if __name__ == "__main__":
    main()